<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>车辆基础资料</title>
<link rel="stylesheet" type="text/css" href="<%=path%>/CSS/backLayout.css">
<link rel="stylesheet" type="text/css" href="<%=path%>/CSS/bombBox.css">
<%-- <link href="<%=path%>/CSS/style.css" rel="stylesheet" type="text/css" /> --%>
<script type="text/javascript" src="<%=path%>/JQuery/jquery-1.8.2.js"></script>
<script type="text/javascript" src="<%=path%>/My97DatePicker/WdatePicker.js"></script>
<%@ include file="/WEB-INF/JSP/backHome/modalWindows/carListPage.jsp"%> 
<%@ include file="/WEB-INF/JSP/backHome/modalWindows/departmentListPage.jsp"%> 
<%@ include file="/WEB-INF/JSP/backHome/modalWindows/CoachListPage.jsp"%>
	<%@ include file="/WEB-INF/JSP/ajax.jsp"%>
<%@ include file="/WEB-INF/JSP/backHome/modalWindows/CoachesListPage.jsp"%>
<style type="text/css">
.seachform li label{line-height: 45px;color: #444444}
.scinput{line-height: 10px;margin-top: 5px}
.scinput1{margin-top: 5px;height: 30px;}
.scbtn{background: #57a0ff;border-radius:20px;width: 110px;margin-top: 4px;height: 35px;outline:none;}
.scbtn2{height: 20px;background: #57a0ff;border-radius:20px;width: 50px;color: #fff;display: none;}

thead {background: #f2f2f2}
tbody tr:nth-child(even) {background: #f7f8fd}
.tablelist th{height: 45px;padding-left: 30px;text-align: center;background: none;border-bottom: none;}
.tablelist td{border-right:none;padding-left: 30px;text-align: center;}
tbody tr{height: 38px}
.check{padding-left: 0px}
a{cursor: pointer;}
.placeul a{color: #444444} 
.success td{border-left:1px solid #dddee6;
				border-right: 1px solid #dddee6;}
.seachform{display: block; list-style-type: disc; -webkit-margin-before: 1em; -webkit-margin-after: 1em; -webkit-margin-start: 0px; -webkit-margin-end: 0px; -webkit-padding-start: 40px;}
.seachform { display: block; margin: 0; padding: 0; list-style: none; border-bottom:none }
.rightinfo { padding: 8px; font-size: 12px}
/* * { border: 0; margin: 0; padding: 0; } */
.scbtn { background: #57a0ff; border-radius: 20px; width: 110px; margin-top: 4px; height: 35px; outline: none;border: 0 }
.scbtn { width: 95px; height: 34px;  font-size: 14px; font-weight: bold; color: #fff; cursor: pointer; border-radius: 50px; behavior: url(js/pie.htc);}
.scinput { width: 150px; height: 30px; line-height: 30px; border-top: solid 1px #a7b5bc; border-left: solid 1px #a7b5bc; border-right: solid 1px #ced9df; border-bottom: solid 1px #ced9df; background: url(../images/inputbg.gif) repeat-x; text-indent: 10px; }
a, a:focus { text-decoration: none; color: #000; outline: none; blr: expression(this.onFocus=this.blur()); }
.seachform li { float: left; margin-right: 15px; }
li { display: block; margin: 0; padding: 0; list-style: none; }
.scinput1 { width: 150px; height: 30px; line-height: 30px; border-top: solid 1px #a7b5bc; border-left: solid 1px #a7b5bc; border-right: solid 1px #ced9df; border-bottom: solid 1px #ced9df; background: url(../images/inputbg.gif) repeat-x; text-indent: 10px; }
.placeul li:last-child { background: none; }
.seachform li label{margin-right: 10px}
.placeul li { float: left; line-height: 40px; padding-left: 7px; padding-right: 12px; background: url(../images/rlist.gif) no-repeat right;font-size: 9px }  
ul{border-bottom: none;}
.findBtn, .findBtn1, .findBtn2:hover {
    background: -webkit-linear-gradient(top, #8DC9EF, #4E9FD1);
    background: -moz-linear-gradient(top, #8DC9EF, #4E9FD1);
    background: linear-gradient(top, #8DC9EF, #4E9FD1);
    background: -ms-linear-gradient(top, #8DC9EF, #4E9FD1);
}
.findBtn, .findBtn1, .findBtn2 {
    background: #427dff, background;
    border-radius: 50px;
    background: -webkit-linear-gradient(top, #57a0ff, #57a1ff);
    background: -moz-linear-gradient(top, #57a0ff, #57a1ff);
    background: linear-gradient(top, #57a0ff, #57a1ff);
    background: -ms-linear-gradient(top, #57a0ff, #57a1ff);
    border: 1px solid #2576A8;
    box-shadow: 0 1px 2px #8AC1E2 inset, 0 -1px 0 #57a0ff inset;
    color: #fff;
    height: 40px;
    text-shadow: 1px 1px 0.5px #57a0ff;
    outline: none;
    margin-left: 100px;
    }
</style>
</head>
<body style="background: #f5f5f5;padding: 0 10px;">
		<div class="place" style="background: #f5f5f5;margin-top: 10px">
			<ul class="placeul">
				<li><a href="#">报表</a></li>
				<li><a href="#">车辆加油统计报表</a></li>
			</ul>
		</div>
	
		<div class="rightinfo" style="background: #fff;border-radius:10px;min-height: 45px;float: left;margin-bottom: 20px;width:99.1%">

			<form action="<%=path%>/DrivingSys/selCarFuelJournalByConOne" method="post">
				<ul class="seachform" >
					    <li><label>车辆</label><input name="carFnumber" id="car" type="text" class="scinput" value="${carRefuelEntry.carFnumber}"/>
					    <input type="hidden"  name="cfcarnoid" class="car" value="${carRefuelEntry.cfcarnoid}" >
					    </li>
					    <li><label>部门</label><input  id="deparment"  type="text" name="cfdepname" class="scinput" value="${carRefuelEntry.cfdepname}"/></li>
					    <li><label>教练员</label>
					    <input id="coach" name="cftrainName" type="text" class="scinput" value="${carRefuelEntry.cftrainName}"/>
					    <input type="hidden"  name="cftrainid" class="coach"  value="${carRefuelEntry.cftrainid}">
					    </li>
					    <li><label>教练队</label>
					    <select style="height: 34px;width: 152px" name="cfteamid">
					    	<option selected="selected"></option>
					    	<c:forEach items="${team}" var="team">	
					    	<c:choose>
					    		<c:when test="${team.fid eq carRefuelEntry.cfteamid}">
					    			<option selected="selected" value="${team.fid}">${team.fnameL2}--${team.fnumber}</option>	
					    		</c:when>
					    		<c:otherwise>
					    			<option value="${team.fid}">${team.fnameL2}--${team.fnumber}</option>	
					    		</c:otherwise>
					    	</c:choose>
					    	</c:forEach>    	
					    </select>
					    </li>
					    
					    <li><label>教练组</label><input id="coachGroup" name="cfgroupName" type="text" class="scinput" value="${carRefuelEntry.cfgroupName}"/>
					    <input type="hidden"  name="cfgroupid" class="coachGroup" value="${carRefuelEntry.cfgroupid}" >
					    </li>				    
				</ul>
				<ul class="seachform" style="float: left;height: 45px" >
					   <li><label style="line-height: 22px;vertical-align:middle;display:inline-block">开始<br>时间</label><input class="scinput1"  name="beginTime" type="text" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}',dateFmt:'yyyy-MM-dd'})"
					    id="datemin" class="input-text Wdate" style="width:150px;" value="${beginTime}"></li>
						<li><label style="line-height: 22px;vertical-align:middle;display:inline-block">结束<br>时间</label><input class="scinput1"  name="endTime" type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'datemin\')}',maxDate:'%y-%M-%d',dateFmt:'yyyy-MM-dd'})"
						id="datemax" class="input-text Wdate" style="width:150px;"value="${endTime}"></li>		
						<li><label>&nbsp;</label><input name="" type="submit"  style="outline: none;" class="scbtn" value="立即查询" /></li>
					<shiro:hasPermission name="/selCarFuelJournalByConOne">
						<label>&nbsp;</label>
						<li style="height: 40px;text-align: left;color: #999999;">
				       	&nbsp;<input  type="button"  id="submitExcel" value="导出EXCLE" class="scbtn" >
							</li>
					</shiro:hasPermission>
				</ul>
			
			</form>
		</div>
		
		
		<div style="width: 100%;overflow:auto;margin-bottom: 0px;margin-top: 30px;background: #fff;border-radius:10px;min-height:600px">
		<form   id="excel"  action="<%=path%>/DrivingSys/outXls" method="post">

		<div  class="success">
						<div style="min-height: 240px;width: 85%;padding-left: 20px;padding-top: 20px;">
						
								<table  width="100%" align="center" id="table"  style="border-collapse:collapse;min-height:30px;border-spacing:0;">
									<thead >
										<td height="55px" style="font-size: 18px;text-align: center;color: black" colspan="8">
											${beginTime} 至 ${endTime} 车辆加油统计报表
										</td>
									</thead>
									<thead>
										<td style="width: 5px;height: 50px;background: rgb(228,234,254);"></td>
										<td style="width: 27px;height: 50px;background: rgb(228,234,254);"  align="center">部门</td>
										<td style="width: 22px;height: 50px;background: rgb(228,234,254);" align="center">科目</td>
										<td style="height: 51px;background: rgb(228,234,254);" align="center">车辆</td>
										<td style="width: 25px;height: 50px;background: rgb(228,234,254);" align="center">教练员</td>
										<td style="width: 23px;height: 50px;background: rgb(228,234,254);" align="center">教练组</td>
										<td style="width: 23px;height: 50px;background: rgb(228,234,254);" align="center">教练队</td>
										<td style="width: 24px;height: 50px;background: rgb(228,234,254);" align="center">加油量（公升）</td>
									</thead>
									<c:forEach items="${otherCarAddOilEntries}" var="otherCarAddOilEntry" > 
									<tr style="border-left: 1px solid #c7c7c7;" >
										<td width="20px"></td>
										<td style="width: 20px;text-align: center;" align="center">${otherCarAddOilEntry.cfdept}</td>
										<td style="width: 20px;text-align: center;" align="center"></td>
										<td style="width: 20px;text-align: center;" align="center">${otherCarAddOilEntry.cfcar}</td>
										<td style="width: 20px;text-align: center;" align="center"></td>
										<td style="width: 20px;text-align: center;" align="center"></td>
										<td style="width: 20px;text-align: center;" align="center"></td>
										<td style="width: 20px;text-align: center;" align="center">${otherCarAddOilEntry.cfqty}</td>								
									</tr>
									</c:forEach>
									<c:forEach items="${carRefuelEntries}" var="carRefuelEntry"> 
									<tr style="border-left: 1px solid #c7c7c7;" id="two" >
										<td width="20px"></td>
										<td style="width: 20px;text-align: center;" align="center">${carRefuelEntry.cfdepname}</td>
										<c:if test="${carRefuelEntry.cfkemu eq 0}">
											<td style="width: 20px;text-align: center;" align="center">其他</td>
										</c:if>
										<c:if test="${carRefuelEntry.cfkemu eq 1}">
											<td style="width: 20px;text-align: center;" align="center">科目一</td>
										</c:if>
										<c:if test="${carRefuelEntry.cfkemu eq 2}">
											<td style="width: 20px;text-align: center;" align="center">科目二</td>
										</c:if>
										<c:if test="${carRefuelEntry.cfkemu eq 3}">
											<td style="width: 20px;text-align: center;" align="center">科目三</td>
										</c:if>
										<c:if test="${carRefuelEntry.cfkemu eq 4}">
											<td style="width: 20px;text-align: center;" align="center">备用车</td>
										</c:if>
										<td style="width: 20px;text-align: center;" align="center">${carRefuelEntry.carFnumber}</td>
										<td style="width: 20px;text-align: center;" align="center">${carRefuelEntry.cftrainName}</td>
										<td style="width: 20px;text-align: center;" align="center">${carRefuelEntry.cfgroupName}</td>
										<td style="width: 20px;text-align: center;" align="center">${carRefuelEntry.cfteamName}</td>
										<td style="width: 20px;text-align: center;" align="center">${carRefuelEntry.cfqty}</td>								
									</tr>
									</c:forEach>				
									<tr class="endRow" >
										<td style="width: 10px;background: rgb(255,193,133);text-align: center;"></td>
										<td style="width: 20px;background: rgb(255,193,133);text-align: center;" align="center">总计</td>
										<td style="width: 20px;background: rgb(255,193,133);text-align: center;" align="center"></td>
										<td style="width: 20px;background: rgb(255,193,133);text-align: center;" align="center"></td>
										<td style="width: 20px;background: rgb(255,193,133);text-align: center;" align="center"></td>
										<td style="width: 20px;background: rgb(255,193,133);text-align: center;" align="center"></td>
										<td style="width: 20px;background: rgb(255,193,133);text-align: center;" align="center"></td>
										<td style="font-weight: 800;width: 20px;background: rgb(255,193,133);text-align: center;" align="center">${endBalance}</td>
									</tr>
								</table>
								
								<input id="xls" type="hidden" name="xls" value="">
                				<input type="hidden" value="车辆加油统计报表" name="fileNames">
								
						</div>
				</div>		
				 </form>
		</div>



		
</body>
<script type="text/javascript">

		$(".scbtn").live('click',function () {
			if($('#car').val() == '')
				$('.car').val("")
			if($('#deparment').val() == '')
				$('.deparment').val("")
            if($('#coachGroup').val() == '')
                $('.coachGroup').val("")
            if($('#coach').val() == '')
                $('.coach').val("")
		})
        $('#submitExcel').live('click',function () {
            $('#excel').submit()
        })

		$(document).ready(function(){
		 
			function _w_table_rowspan_two(_w_table_id,_w_table_colnum,flag){
			    _w_table_firsttd = "";//需要合并的第一行
			    _w_table_currenttd = "";//当前行
			    _w_table_SpanNum = 0;//相同的行数
			/*     var num_person =0;//人员数量统计
			    var num_department=0;//部门数量统计 */
			    var length = $(_w_table_id).find('tr').length//表格的长度
			    _w_table_Obj = $(_w_table_id + " tr td:nth-child(" + _w_table_colnum + ")");	    	    
			    //需要增加的人员小计行	   
			    _w_table_Obj.each(function(i){
			    	//统计相同部门的数量
			    	/* if($(this).next().text() == '小计'){
			    		num_department+=Number($(this).next().parent().find("td:last").text())
			    	} */
			        if(i==0){
			            _w_table_firsttd = $(this);		            
			            _w_table_SpanNum = 1;
			            _td = $(this).parent().find('td:eq(1)');
			            _td3 = $(this).parent().find('td:eq(2)');
			           /*  num_person = Number(_w_table_firsttd.parent().find("td:last").text())	 */            
			        }else{	        	
			            _w_table_currenttd = $(this);
			           /*  if (_w_table_SpanNum == 1) {
			            	num_person =Number( _w_table_firsttd.parent().find("td:last").text())
		                }	  */           
			            _td2 = $(this).parent().find('td:eq(1)');
			            _td4 = $(this).parent().find('td:eq(2)');
	                    if (_td.text() == _td2.text() && _td3.text() == _td4.text()) {
	                    	
	                    	if(i == length-2){
	                    	var str='';//需要添加的行
			            	var str1 = ''
			            		 	 
		    	    	    str='<tr><td style="text-align: center; width: 2px;"></td>'
		    	    	    	str+='<td style="text-align: center; width: 20px;background: rgb(250,255,193);" >'+_w_table_firsttd.prev().html()+'</td>'
		        	    		str+='<td style="text-align: center; width: 10px;background: rgb(250,255,193);" >小计</td>'
		        	    			str+='<td style="text-align: center; width: 10px;background: rgb(250,255,193);" ></td>'
			        	    			str+='<td style="text-align: center; width: 10px;background: rgb(250,255,193);" ></td>'
			        	    				str+='<td style="text-align: center; width: 10px;background: rgb(250,255,193);" ></td>'
			        	    					str+='<td style="text-align: center; width: 20px;background: rgb(250,255,193);" ></td>'
			        			    	    		str+='<td style="font-weight: 800;text-align: center; width: 10px;background: rgb(250,255,193);" ></td></tr>'
			        			    	    		
			        	    	str1='<tr><td style="text-align: center; width: 2px;" ></td>'
		    	    			str1+='<td style="text-align: center; width: 20px;background: rgb(250,255,193);" >小计</td>'
		        	    		str1+='<td style="text-align: center; width: 10px;background: rgb(250,255,193);" ></td>'
		        	    			str1+='<td style="text-align: center; width: 10px;background: rgb(250,255,193);" ></td>'
		        	    				str1+='<td style="text-align: center; width: 10px;background: rgb(250,255,193);" ></td>'
		        	    					str1+='<td style="text-align: center; width: 10px;background: rgb(250,255,193);" ></td>'
		        	    						str1+='<td style="text-align: center; width: 10px;background: rgb(250,255,193);" ></td>'
			    	    		str1+='<td style="font-weight: 800;text-align: center; width: 10px;background: rgb(250,255,193);" class="num_department"></td></tr>'
			    	    		$(_w_table_id).append(str)	
			    	    		$(_w_table_id).append(str1)	
	                    	}
	                        _w_table_SpanNum++;
	                        _w_table_currenttd.remove(); //remove();
	                        _w_table_firsttd.attr("rowSpan", _w_table_SpanNum);
			            }else{
			            	var str='';//需要添加的行
			            	var str1 = ''
		    	    	    str='<tr><td style="text-align: center; width: 2px;" ></td>'
		    	    	    	str+='<td style="text-align: center; width: 20px;background: rgb(152,219,157);" >'+_w_table_firsttd.prev().html()+'</td>'
		        	    		str+='<td style="text-align: center; width: 10px;background: rgb(152,219,157);" >小计</td>'
		        	    			str+='<td style="text-align: center; width: 10px;background: rgb(152,219,157);" ></td>'
			        	    			str+='<td style="text-align: center; width: 10px;background: rgb(152,219,157);" ></td>'
			        	    				str+='<td style="text-align: center; width: 10px;background: rgb(152,219,157);" ></td>'
			        	    					str+='<td style="text-align: center; width: 20px;background: rgb(152,219,157);" ></td>'
			        			    	    		str+='<td style="font-weight: 800;text-align: center; width: 10px;background: rgb(152,219,157);" ></td></tr>'
			        	    	str1='<tr><td style="text-align: center; width: 2px;" class="xuhao"></td>'
		    	    			str1+='<td style="text-align: center; width: 20px;background: rgb(250,255,193);" >小计</td>'
		        	    		str1+='<td style="text-align: center; width: 10px;background: rgb(250,255,193);" ></td>'
		        	    			str1+='<td style="text-align: center; width: 10px;background: rgb(250,255,193);" ></td>'
		        	    				str1+='<td style="text-align: center; width: 10px;background: rgb(250,255,193);" ></td>'
		        	    					str1+='<td style="text-align: center; width: 10px;background: rgb(250,255,193);" ></td>'
		        	    						str1+='<td style="text-align: center; width: 10px;background: rgb(250,255,193);" ></td>'
			    	    		str1+='<td style="font-weight: 800;text-align: center; width: 10px;background: rgb(250,255,193);" class="num_department"></td></tr>'
			            	if(_w_table_SpanNum == 1){		            		
			    	             $(this).parent().prev().after(str)	 
			    	         
			            	}
		    	    		if(_w_table_SpanNum != 1){
		    	    			$(this).parent().prev().after(str)	
		    	    			
		    	    		}   
		    	    		
			                _w_table_firsttd = $(this);
			                _td = $(this).parent().find('td:eq(1)');
			                _td3 = $(this).parent().find('td:eq(2)');
			                _w_table_SpanNum = 1;
			             
			            }
			        }
			    }); 
			    
			    
			}
	
		
			/*   
		    _w_table_rowspan3("#table", "3")  
		    
		
		    _w_table_rowspan4("#table", "2")
		     */
		    
			  
			 
		
		
		/* 	
		function _w_table_rowspan3(_w_table_id, _w_table_colnum) {
            _w_table_firsttd = "";
            _w_table_currenttd = "";
            _w_table_SpanNum = 0;
            _w_table_Obj = $(_w_table_id + ' tr td:nth-child(' + _w_table_colnum + ')');
            _w_table_Obj.each(function (i) {
                if (i == 0) {
                    _w_table_firsttd = $(this);
                    _w_table_SpanNum = 1;
                    _td = $(this).parent().find('td:eq(1)');
                    _td3 = $(this).parent().find('td:eq(2)');
                }
                else {
                    _w_table_currenttd = $(this);
                    _td2 = $(this).parent().find('td:eq(1)');
                    _td4 = $(this).parent().find('td:eq(2)');
                    if (_td.text() == _td2.text() && _td3.text() == _td4.text()) {
                        _w_table_SpanNum++;
                        _w_table_currenttd.remove(); //remove();
                        _w_table_firsttd.attr("rowSpan", _w_table_SpanNum);
                    } else {
                        _w_table_firsttd = $(this);
                        _td = $(this).parent().find('td:eq(1)');
                        _td3 = $(this).parent().find('td:eq(2)');
                        _w_table_SpanNum = 1;
                    }
                }
            });
        } */
			function _w_table_rowspan(_w_table_id,_w_table_colnum){     
	            _w_table_firsttd = "";     
	            _w_table_currenttd = "";     
	            _w_table_SpanNum = 0;     
	            _w_table_Obj = $(_w_table_id + " tr td:nth-child(" + _w_table_colnum + ")");     
	            _w_table_Obj.each(function(i){     
	                if(i==0){     
	                    _w_table_firsttd = $(this);     
	                    _w_table_SpanNum = 1;     
	                }else{     
	                    _w_table_currenttd = $(this);     
	                    if(_w_table_firsttd.text()==_w_table_currenttd.text()){     
	                        _w_table_SpanNum++;     
	                        _w_table_currenttd.remove(); //remove();     
	                        _w_table_firsttd.attr("rowSpan",_w_table_SpanNum);     
	                    }else{     
	                    	var str1 = ''
	                    	str1='<tr class="xuhao"><td style="text-align: center; width: 2px;" ></td>'
		    	    			str1+='<td style="text-align: center; width: 20px;background: rgb(250,255,193);" >小计</td>'
		        	    		str1+='<td style="text-align: center; width: 10px;background: rgb(250,255,193);" ></td>'
		        	    			str1+='<td style="text-align: center; width: 10px;background: rgb(250,255,193);" ></td>'
		        	    				str1+='<td style="text-align: center; width: 10px;background: rgb(250,255,193);" ></td>'
		        	    					str1+='<td style="text-align: center; width: 10px;background: rgb(250,255,193);" ></td>'
		        	    						str1+='<td style="text-align: center; width: 10px;background: rgb(250,255,193);" ></td>'
			    	    		str1+='<td style="font-weight: 800;text-align: center; width: 10px;background: rgb(250,255,193);" class="num_department"></td></tr>'
			    	    		if(_w_table_SpanNum == 1){		            		
				    	             $(this).parent().prev().after(str1)	 
				            	}
			    	    		if(_w_table_SpanNum != 1){
			    	    			$(this).parent().prev().after(str1)	
			    	    		}   
	                        _w_table_firsttd = $(this);     
	                        _w_table_SpanNum = 1;     
	                    }     
	                }     
	            });      
	            
	 }     
			
			  
			 _w_table_rowspan_two("#table", "3","0")  
			
		    
		    _w_table_rowspan("#table", "2")   
		    
		    

			 totalPrice = 0  //部门小计
			 totalPrice1 = 0  //科目小计
			 totalCount = 0
		    $('#table tr:not(:first)').each(function(i){
		    	if(i == 0){}
		    	else{
		    		$('.endRow').nextAll().remove()
		    		if($(this).find('td:eq(1)').html() == '合计'){}else{
		    		totalCount = totalCount	+ ($(this).find("td:last").html()-0) 
		    		}
				if($(this).hasClass("xuhao")){
					$(this).find("td:last").html(totalPrice)
					 totalPrice = 0
				}else{
					if($(this).find('td:eq(1)').html() == '小计'){
		    			
						$(this).find("td:last").html(totalPrice1)

						totalPrice1 = 0
			    	}else{

						totalPrice1 = (totalPrice1-0) +($(this).find("td:last").html()-0)
						
						totalPrice = (totalPrice-0) +($(this).find("td:last").html()-0)
						/* alert(totalPrice) */
					}
					}
				} 
		    	
		    	$('.endRow').find("td:last").html(totalCount)
		    	
			})
		    
		 
			
			$('#car').click(function(e){
				$('#modal-overlay').css('visibility','visible') 
				$('.modal-data5').css('visibility','visible')
				$('input:checkbox').removeAttr('checked');	
				_this =$(this).parent().parent();
			})
			
			$('#deparment').click(function(e){
				$('#modal-overlay').css('visibility','visible') 
				$('.modal-data6').css('visibility','visible')
				$('input:checkbox').removeAttr('checked');
				_this =$(this).parent();
			})
			
			$('#coach').click(function() {
				$('#modal-overlay').css('visibility','visible') 
				$('.modal-data1').css('visibility','visible')
				$('.page').show();
				$('input:checkbox').removeAttr('checked');
				_this =$(this).parent().parent();
			})
	
			
			$('#coachGroup').click(function(e) {
				$('#modal-overlay').css('visibility','visible') 
				$('.modal-data2').css('visibility','visible')
				$('.page').show();
				$('input:checkbox').removeAttr('checked');
				_this =$(this).parent().parent();
			})
			
			$('.subtn2').click(function(){
				 var spCodesTemp = "";
                $('.coacegroup input:checkbox[name=coachesfid]:checked').each(function (i) {
			       if(0==i){
			        spCodesTemp = $(this).val();
			       }else{
			        spCodesTemp += (","+$(this).val());
			       }
			      });
			      spCodesTemp = spCodesTemp.split(",")
			      $.ajax({
					    url:'<%=path%>/DrivingSys/selectCoaceGroupByFidAsPage', 
					    type: "post",
					    data:{'id':spCodesTemp[0]},
					    dataType:"json",         	
					    success: function(json) {
					    	$('#coachGroup').val(json[0].fnameL2)
					    	$('.coachGroup').val(json[0].fid)
			            	$('#modal-overlay').css('visibility','hidden')
							$('.modal-data2').css('visibility','hidden')
						},  
						error: function(){alert('Error');} 
			 			});
			})
			
			
			$('.subtn1').click(function(){
				 var spCodesTemp = "";
			      $('input:checkbox[name=personfid]:checked').each(function(i){
			       if(0==i){
			        spCodesTemp = $(this).val();
			       }else{
			        spCodesTemp += (","+$(this).val());
			       }
			      });
			      spCodesTemp = spCodesTemp.split(",")
			      $.ajax({
					    url:'<%=path%>/DrivingSys/selectPersonByFidAsPage', 
					    type: "post",
					    data:{'id':spCodesTemp[0]},
					    dataType:"json",         	
					    success: function(json) {
					    	alert(json[0].fid)
					    	$('#coach').val(json[0].jlname)
					    	$('.coach').val(json[0].fid)
			            	$('#modal-overlay').css('visibility','hidden')
							$('.modal-data1').css('visibility','hidden')
						},  
						error: function(){alert('Error');} 
			 			});
			})
			
			$('#subtn6').click(function(){
				   var dep = $('input:checkbox[name=train3]:checked').parent()

			        /*_this.children().children('input[class=carName]').val(car.next().html());
			         _this.children().children('input[class=cfcarid]').val($('input:checkbox[name=train]:checked').val());
			         _this.children().children('input[class=cfcarno]').val(car.next().next().html());*/
			        $('#deparment').val(dep.next().next().html())
		
			        $('#modal-overlay').css('visibility', 'hidden')
			        $('.modal-data6').css('visibility', 'hidden')
			        $('input:checkbox[name=train3]:checked').removeAttr("checked");

			})
			
			$('#subtn5').click(function(){
				   var dep = $('input:checkbox[name=train]:checked').parent()

			        /*_this.children().children('input[class=carName]').val(car.next().html());
			         _this.children().children('input[class=cfcarid]').val($('input:checkbox[name=train]:checked').val());
			         _this.children().children('input[class=cfcarno]').val(car.next().next().html());*/
			         $('#car').val(dep.next().html())
			         $('.car').val($('input:checkbox[name=train]:checked').val())
			        $('#modal-overlay').css('visibility', 'hidden')
			        $('.modal-data5').css('visibility', 'hidden')
			        $('input:checkbox[name=train3]:checked').removeAttr("checked");

			})
			
			$('.btn').click(function () {
		    $('#modal-overlay').css('visibility', 'hidden')
		    $('.modal-data').css('visibility', 'hidden')
		    $('.modal-data1').css('visibility', 'hidden')
		    $('.modal-data2').css('visibility', 'hidden')
		    $('.modal-data3').css('visibility', 'hidden')
		    $('.modal-data4').css('visibility', 'hidden')
		    $('.modal-data5').css('visibility', 'hidden')
		    $('.modal-data6').css('visibility', 'hidden')
		    $('.data-checkbox:checkbox').removeAttr('checked');
		    $('.data1-checkbox:checkbox').removeAttr('checked');
		    $('.data2-checkbox:checkbox').removeAttr('checked');
		    $('.data3-checkbox:checkbox').removeAttr('checked');
		    $('.data4-checkbox:checkbox').removeAttr('checked');
		    $('.data5-checkbox:checkbox').removeAttr('checked');
		    $('.page').hide();
		})
		$('#xls').val($('.success').html());
			
	    })
		
</script>
</html>